package com.restaurantonlineorder.seller.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.restaurantonlineorder.seller.domain.User;
import com.restaurantonlineorder.seller.mapper.UserMapper;
import com.restaurantonlineorder.seller.service.IUserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;

/**
 * @author 熊宇
 * @date 2022/7/24 15:38
 * @description 用户实现类
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {


    @Override
    @Transactional(rollbackFor = RuntimeException.class)
    public boolean deductMoney(Long id, BigDecimal money) {
        return this.baseMapper.deductMoney(id, money);
    }

    @Override
    @Transactional(rollbackFor = RuntimeException.class)
    public boolean earnMoney(Long id, BigDecimal money) {
        return this.baseMapper.earnMoney(id, money);
    }

    @Override
    public boolean existsUserStoreByPhone(String phone, Long storeId) {
        return this.baseMapper.existsUserStoreByPhone(phone, storeId);
    }
}
